home *** CD-ROM | disk | FTP | other *** search
- Path: ip-salem3-26.teleport.com!user
- From: dynamix@teleport.com (Steve Budrys)
- Newsgroups: comp.lang.c++
- Subject: Re: How to delete array of pointers?
- Date: Sat, 10 Feb 1996 16:29:25 -0800
- Organization: Dynamix Trading
- Message-ID: <dynamix-1002961629250001@ip-salem3-26.teleport.com>
- References: <4fgvsu$5q4@eng_ser1.erg.cuhk.hk>
- NNTP-Posting-Host: ip-salem3-26.teleport.com
-
- In article <4fgvsu$5q4@eng_ser1.erg.cuhk.hk>, ywleung@cs.cuhk.hk (Marty
- McFly) wrote:
-
- > If I write the following code in a function:
- >
- > int** ptr;
- > ptr = new int*[1000];
- >
- > Is this code means allocating 1000 integer pointers which is pointed by ptr?
- > And then somehow I assign integer variable to ptr[0], ptr[1], ... and so on.
- > So at the end of the function, how can I reclaim just those pointers? The key
- > point is that those integer variable assigned to the pointers should not be
- > deleted.
-
- Simply
- delete [] ptr;
-
- The things to which they pointed will not be touched.
-